//
//  File.swift
//  Documentation
//
//  Created by Toj on 6/19/23.
//

public class CGContext : Hashable { }

extension CGContext {

    public func setLineDash(phase: CGFloat, lengths: [CGFloat])

    public func move(to point: CGPoint)

    public func addLine(to point: CGPoint)

    public func addCurve(to end: CGPoint, control1: CGPoint, control2: CGPoint)

    public func addQuadCurve(to end: CGPoint, control: CGPoint)

    public func addRects(_ rects: [CGRect])

    public func addLines(between points: [CGPoint])

    public func addArc(center: CGPoint, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat, clockwise: Bool)

    public func addArc(tangent1End: CGPoint, tangent2End: CGPoint, radius: CGFloat)

    /// Fills the current path using the specified rule (winding by default).
    ///
    /// Any open subpath is implicitly closed.
    public func fillPath(using rule: CGPathFillRule = .winding)

    /// Intersects the current path with the current clipping region and uses the
    /// result as the new clipping region for subsequent drawing.
    ///
    /// Uses the specified fill rule (winding by default) to determine which
    /// areas to treat as the interior of the clipping region. When evaluating
    /// the path, any open subpath is implicitly closed.
    public func clip(using rule: CGPathFillRule = .winding)

    public func fill(_ rects: [CGRect])

    public func strokeLineSegments(between points: [CGPoint])

    public func clip(to rects: [CGRect])

    public func draw(_ image: CGImage, in rect: CGRect, byTiling: Bool = false)

    public var textPosition: CGPoint

    public func showGlyphs(_ glyphs: [CGGlyph], at positions: [CGPoint])
}

extension CGContext {

    public func draw(_ layer: CGLayer, in rect: CGRect)

    public func draw(_ layer: CGLayer, at point: CGPoint)
}

/* Drawing modes for paths. */

public enum CGPathDrawingMode : Int32, @unchecked Sendable {

    
    case fill = 0

    case eoFill = 1

    case stroke = 2

    case fillStroke = 3

    case eoFillStroke = 4
}

/* Drawing modes for text. */

public enum CGTextDrawingMode : Int32, @unchecked Sendable {

    
    case fill = 0

    case stroke = 1

    case fillStroke = 2

    case invisible = 3

    case fillClip = 4

    case strokeClip = 5

    case fillStrokeClip = 6

    case clip = 7
}

/* Interpolation quality. */

public enum CGInterpolationQuality : Int32, @unchecked Sendable {

    
    case `default` = 0 /* Let the context decide. */

    case none = 1 /* Never interpolate. */

    case low = 2 /* Low quality, fast interpolation. */

    case medium = 4 /* Medium quality, slower than kCGInterpolationLow. */

    case high = 3 /* Highest quality, slower than kCGInterpolationMedium. */
}

/* Blend modes.

   The blend modes from kCGBlendModeNormal to kCGBlendModeLuminosity are
   supported in Mac OS X 10.4 and later. The Porter-Duff blend modes (from
   kCGBlendModeClear to kCGBlendModePlusLighter) are supported in Mac OS X
   10.5 and later. The names of the Porter-Duff blend modes are historical.

   Note that the Porter-Duff blend modes are not necessarily supported in
   every context. In particular, they are only guaranteed to work in
   bitmap-based contexts, such as those created by CGBitmapContextCreate. It
   is your responsibility to make sure that they do what you want when you
   use them in a CGContext. */

public enum CGBlendMode : Int32, @unchecked Sendable {

    
    /* Available in Mac OS X 10.4 & later. */
    case normal = 0

    case multiply = 1

    case screen = 2

    case overlay = 3

    case darken = 4

    case lighten = 5

    case colorDodge = 6

    case colorBurn = 7

    case softLight = 8

    case hardLight = 9

    case difference = 10

    case exclusion = 11

    case hue = 12

    case saturation = 13

    case color = 14

    case luminosity = 15

    
    /* Available in Mac OS X 10.5 & later. R, S, and D are, respectively,
           premultiplied result, source, and destination colors with alpha; Ra,
           Sa, and Da are the alpha components of these colors.
    
           The Porter-Duff "source over" mode is called `kCGBlendModeNormal':
             R = S + D*(1 - Sa)
    
           Note that the Porter-Duff "XOR" mode is only titularly related to the
           classical bitmap XOR operation (which is unsupported by
           CoreGraphics). */
    
    case clear = 16 /* R = 0 */

    case copy = 17 /* R = S */

    case sourceIn = 18 /* R = S*Da */

    case sourceOut = 19 /* R = S*(1 - Da) */

    case sourceAtop = 20 /* R = S*Da + D*(1 - Sa) */

    case destinationOver = 21 /* R = S*(1 - Da) + D */

    case destinationIn = 22 /* R = D*Sa */

    case destinationOut = 23 /* R = D*(1 - Sa) */

    case destinationAtop = 24 /* R = S*(1 - Da) + D*Sa */

    case xor = 25 /* R = S*(1 - Da) + D*(1 - Sa) */

    case plusDarker = 26 /* R = MAX(0, (1 - D) + (1 - S)) */

    case plusLighter = 27 /* R = MIN(1, S + D) */
}
extension CGContext {

    
    /* Return the CFTypeID for CGContextRefs. */
    
    @available(iOS 2.0, *)
    public class var typeID: CFTypeID { get }

    
    
    /* Push a copy of the current graphics state onto the graphics state stack.
       Note that the path is not considered part of the graphics state, and is
       not saved. */
    
    /** Graphics state functions. **/
    @available(iOS 2.0, *)
    public func saveGState()

    
    /* Restore the current graphics state from the one on the top of the
       graphics state stack, popping the graphics state stack in the process. */
    
    @available(iOS 2.0, *)
    public func restoreGState()

    
    
    /* Scale the current graphics state's transformation matrix (the CTM) by
       `(sx, sy)'. */
    
    /** Coordinate space transformations. **/
    @available(iOS 2.0, *)
    public func scaleBy(x sx: CGFloat, y sy: CGFloat)

    
    /* Translate the current graphics state's transformation matrix (the CTM) by
       `(tx, ty)'. */
    
    @available(iOS 2.0, *)
    public func translateBy(x tx: CGFloat, y ty: CGFloat)

    
    /* Rotate the current graphics state's transformation matrix (the CTM) by
       `angle' radians. */
    
    @available(iOS 2.0, *)
    public func rotate(by angle: CGFloat)

    
    /* Concatenate the current graphics state's transformation matrix (the CTM)
       with the affine transform `transform'. */
    
    @available(iOS 2.0, *)
    public func concatenate(_ transform: CGAffineTransform)

    
    /* Return the current graphics state's transformation matrix. Returns
       CGAffineTransformIdentity in case of inavlid context. */
    
    @available(iOS 2.0, *)
    public var ctm: CGAffineTransform { get }

    
    
    /* Set the line width in the current graphics state to `width'. */
    
    /** Drawing attribute functions. **/
    @available(iOS 2.0, *)
    public func setLineWidth(_ width: CGFloat)

    
    /* Set the line cap in the current graphics state to `cap'. */
    
    @available(iOS 2.0, *)
    public func setLineCap(_ cap: CGLineCap)

    
    /* Set the line join in the current graphics state to `join'. */
    
    @available(iOS 2.0, *)
    public func setLineJoin(_ join: CGLineJoin)

    
    /* Set the miter limit in the current graphics state to `limit'. */
    
    @available(iOS 2.0, *)
    public func setMiterLimit(_ limit: CGFloat)

    
    /* Set the line dash patttern in the current graphics state of `c'. */
    
    /* Set the path flatness parameter in the current graphics state of `c' to
       `flatness'. */
    
    @available(iOS 2.0, *)
    public func setFlatness(_ flatness: CGFloat)

    
    /* Set the alpha value in the current graphics state of `c' to `alpha'. */
    
    @available(iOS 2.0, *)
    public func setAlpha(_ alpha: CGFloat)

    
    /* Set the blend mode of `context' to `mode'. */
    
    @available(iOS 2.0, *)
    public func setBlendMode(_ mode: CGBlendMode)

    
    
    /* Note that a context has a single path in use at any time: a path is not
       part of the graphics state. */
    
    /* Begin a new path. The old path is discarded. */
    
    /** Path construction functions. **/
    @available(iOS 2.0, *)
    public func beginPath()

    
    /* Start a new subpath at point `(x, y)' in the context's path. */
    
    /* Append a straight line segment from the current point to `(x, y)'. */
    
    /* Append a cubic Bezier curve from the current point to `(x,y)', with
       control points `(cp1x, cp1y)' and `(cp2x, cp2y)'. */
    
    /* Append a quadratic curve from the current point to `(x, y)', with control
       point `(cpx, cpy)'. */
    
    /* Close the current subpath of the context's path. */
    
    @available(iOS 2.0, *)
    public func closePath()

    
    
    /* Add a single rect to the context's path. */
    
    /** Path construction convenience functions. **/
    @available(iOS 2.0, *)
    public func addRect(_ rect: CGRect)

    
    /* Add a set of rects to the context's path. */
    
    /* Add a set of lines to the context's path. */
    
    /* Add an ellipse inside `rect' to the current path of `context'. See the
       function `CGPathAddEllipseInRect' for more information on how the path
       for the ellipse is constructed. */
    
    @available(iOS 2.0, *)
    public func addEllipse(in rect: CGRect)

    
    /* Add an arc of a circle to the context's path, possibly preceded by a
       straight line segment. `(x, y)' is the center of the arc; `radius' is its
       radius; `startAngle' is the angle to the first endpoint of the arc;
       `endAngle' is the angle to the second endpoint of the arc; and
       `clockwise' is 1 if the arc is to be drawn clockwise, 0 otherwise.
       `startAngle' and `endAngle' are measured in radians. */
    
    /* Add an arc of a circle to the context's path, possibly preceded by a
       straight line segment. `radius' is the radius of the arc. The arc is
       tangent to the line from the current point to `(x1, y1)', and the line
       from `(x1, y1)' to `(x2, y2)'. */
    
    /* Add `path' to the path of context. The points in `path' are transformed
       by the CTM of context before they are added. */
    
    @available(iOS 2.0, *)
    public func addPath(_ path: CGPath)

    
    /** Path stroking. **/
    
    /* Replace the path in `context' with the stroked version of the path, using
       the parameters of `context' to calculate the stroked path. The resulting
       path is created such that filling it with the appropriate color will
       produce the same results as stroking the original path. You can use this
       path in the same way you can use the path of any context; for example,
       you can clip to the stroked version of a path by calling this function
       followed by a call to "CGContextClip". */
    
    @available(iOS 2.0, *)
    public func replacePathWithStrokedPath()

    
    
    /* Return true if the path of `context' contains no elements, false
       otherwise. */
    
    /** Path information functions. **/
    @available(iOS 2.0, *)
    public var isPathEmpty: Bool { get }

    
    /* Return the current point of the current subpath of the path of
       `context'. */
    
    @available(iOS 2.0, *)
    public var currentPointOfPath: CGPoint { get }

    
    /* Return the bounding box of the path of `context'. The bounding box is the
       smallest rectangle completely enclosing all points in the path, including
       control points for Bezier and quadratic curves. */
    
    @available(iOS 2.0, *)
    public var boundingBoxOfPath: CGRect { get }

    
    /* Return a copy of the path of `context'. The returned path is specified in
       the current user space of `context'. */
    
    @available(iOS 2.0, *)
    public var path: CGPath? { get }

    
    /* Return true if `point' is contained in the current path of `context'. A
       point is contained within a context's path if it is inside the painted
       region when the path is stroked or filled with opaque colors using the
       path drawing mode `mode'. `point' is specified is user space. */
    
    @available(iOS 2.0, *)
    public func pathContains(_ point: CGPoint, mode: CGPathDrawingMode) -> Bool

    
    
    /* Draw the context's path using drawing mode `mode'. */
    
    /** Path drawing functions. **/
    @available(iOS 2.0, *)
    public func drawPath(using mode: CGPathDrawingMode)

    
    /** Path drawing convenience functions. **/
    
    /* Fill the context's path using the winding-number fill rule. Any open
       subpath of the path is implicitly closed. */
    
    /* Fill the context's path using the even-odd fill rule. Any open subpath of
       the path is implicitly closed. */
    
    /* Stroke the context's path. */
    
    @available(iOS 2.0, *)
    public func strokePath()

    
    /* Fill `rect' with the current fill color. */
    
    @available(iOS 2.0, *)
    public func fill(_ rect: CGRect)

    
    /* Fill `rects', an array of `count' CGRects, with the current fill
       color. */
    
    /* Stroke `rect' with the current stroke color and the current linewidth. */
    
    @available(iOS 2.0, *)
    public func stroke(_ rect: CGRect)

    
    /* Stroke `rect' with the current stroke color, using `width' as the the
       line width. */
    
    @available(iOS 2.0, *)
    public func stroke(_ rect: CGRect, width: CGFloat)

    
    /* Clear `rect' (that is, set the region within the rect to transparent). */
    
    @available(iOS 2.0, *)
    public func clear(_ rect: CGRect)

    
    /* Fill an ellipse (an oval) inside `rect'. */
    
    @available(iOS 2.0, *)
    public func fillEllipse(in rect: CGRect)

    
    /* Stroke an ellipse (an oval) inside `rect'. */
    
    @available(iOS 2.0, *)
    public func strokeEllipse(in rect: CGRect)

    
    /* Stroke a sequence of line segments one after another in `context'. The
       line segments are specified by `points', an array of `count' CGPoints.
       This function is equivalent to
    
         CGContextBeginPath(context);
         for (k = 0; k < count; k += 2) {
           CGContextMoveToPoint(context, s[k].x, s[k].y);
           CGContextAddLineToPoint(context, s[k+1].x, s[k+1].y);
         }
         CGContextStrokePath(context); */
    
    /** Clipping functions. **/
    
    /* Intersect the context's path with the current clip path and use the
       resulting path as the clip path for subsequent rendering operations. Use
       the winding-number fill rule for deciding what's inside the path. */
    
    /* Intersect the context's path with the current clip path and use the
       resulting path as the clip path for subsequent rendering operations. Use
       the even-odd fill rule for deciding what's inside the path. */
    
    /* Reset the current clip of `c' to the default value. */
    
    public func resetClip()

    
    /* Add `mask' transformed to `rect' to the clipping area of `context'. The
       mask, which may be either an image mask or an image, is mapped into the
       specified rectangle and intersected with the current clipping area of the
       context.
    
       If `mask' is an image mask, then it clips in a manner identical to the
       behavior if it were used with "CGContextDrawImage": it indicates an area
       to be masked out (left unchanged) when drawing. The source samples of the
       image mask determine which points of the clipping area are changed,
       acting as an "inverse alpha": if the value of a source sample in the
       image mask is S, then the corresponding point in the current clipping
       area will be multiplied by an alpha of (1-S). (For example, if S is 1,
       then the point in the clipping area becomes clear, while if S is 0, the
       point in the clipping area is unchanged.
    
       If `mask' is an image, then it serves as alpha mask and is blended with
       the current clipping area. The source samples of mask determine which
       points of the clipping area are changed: if the value of the source
       sample in mask is S, then the corresponding point in the current clipping
       area will be multiplied by an alpha of S. (For example, if S is 0, then
       the point in the clipping area becomes clear, while if S is 1, the point
       in the clipping area is unchanged.
    
       If `mask' is an image, then its color space must be of kCGColorSpaceModelMonochrome
       model, may not have alpha, and may not be masked by an image mask or masking
       color. */
    
    @available(iOS 2.0, *)
    public func clip(to rect: CGRect, mask: CGImage)

    
    /* Return the bounding box of the clip path of `c' in user space. The
       bounding box is the smallest rectangle completely enclosing all points in
       the clip. */
    
    @available(iOS 2.0, *)
    public var boundingBoxOfClipPath: CGRect { get }

    
    
    /* Intersect the current clipping path with `rect'. Note that this function
       resets the context's path to the empty path. */
    
    /** Clipping convenience functions. **/
    @available(iOS 2.0, *)
    public func clip(to rect: CGRect)

    
    /* Intersect the current clipping path with the clipping region formed by
       creating a path consisting of all rects in `rects'. Note that this
       function resets the context's path to the empty path. */
    
    
    /* Set the current fill color in the context `c' to `color'. */
    
    /** Primitive color functions. **/
    @available(iOS 2.0, *)
    public func setFillColor(_ color: CGColor)

    
    /* Set the current stroke color in the context `c' to `color'. */
    
    @available(iOS 2.0, *)
    public func setStrokeColor(_ color: CGColor)

    
    
    /* Set the current fill color space in `context' to `space'. As a
       side-effect, set the fill color to a default value appropriate for the
       color space. */
    
    /** Color space functions. **/
    @available(iOS 2.0, *)
    public func setFillColorSpace(_ space: CGColorSpace)

    
    /* Set the current stroke color space in `context' to `space'. As a
       side-effect, set the stroke color to a default value appropriate for the
       color space. */
    
    @available(iOS 2.0, *)
    public func setStrokeColorSpace(_ space: CGColorSpace)

    
    
    /* Set the components of the current fill color in `context' to the values
       specifed by `components'. The number of elements in `components' must be
       one greater than the number of components in the current fill color space
       (N color components + 1 alpha component). The current fill color space
       must not be a pattern color space. */
    
    /** Color functions. **/
    @available(iOS 2.0, *)
    public func setFillColor(_ components: UnsafePointer<CGFloat>)

    
    /* Set the components of the current stroke color in `context' to the values
       specifed by `components'. The number of elements in `components' must be
       one greater than the number of components in the current stroke color
       space (N color components + 1 alpha component). The current stroke color
       space must not be a pattern color space. */
    
    @available(iOS 2.0, *)
    public func setStrokeColor(_ components: UnsafePointer<CGFloat>)

    
    
    /* Set the components of the current fill color in `context' to the values
       specifed by `components', and set the current fill pattern to `pattern'.
       The number of elements in `components' must be one greater than the
       number of components in the current fill color space (N color components
       + 1 alpha component). The current fill color space must be a pattern
       color space. */
    
    /** Pattern functions. **/
    @available(iOS 2.0, *)
    public func setFillPattern(_ pattern: CGPattern, colorComponents components: UnsafePointer<CGFloat>)

    
    /* Set the components of the current stroke color in `context' to the values
       specifed by `components', and set the current stroke pattern to
       `pattern'. The number of elements in `components' must be one greater
       than the number of components in the current stroke color space (N color
       components + 1 alpha component). The current stroke color space must be a
       pattern color space. */
    
    @available(iOS 2.0, *)
    public func setStrokePattern(_ pattern: CGPattern, colorComponents components: UnsafePointer<CGFloat>)

    
    /* Set the pattern phase in the current graphics state of `context' to
       `phase'. */
    
    @available(iOS 2.0, *)
    public func setPatternPhase(_ phase: CGSize)

    
    
    /* Set the current fill color space in `context' to `DeviceGray' and set the
       components of the current fill color to `(gray, alpha)'. */
    
    /** Color convenience functions. **/
    @available(iOS 2.0, *)
    public func setFillColor(gray: CGFloat, alpha: CGFloat)

    
    /* Set the current stroke color space in `context' to `DeviceGray' and set
       the components of the current stroke color to `(gray, alpha)'. */
    
    @available(iOS 2.0, *)
    public func setStrokeColor(gray: CGFloat, alpha: CGFloat)

    
    /* Set the current fill color space in `context' to `DeviceRGB' and set the
       components of the current fill color to `(red, green, blue, alpha)'. */
    
    @available(iOS 2.0, *)
    public func setFillColor(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)

    
    /* Set the current stroke color space in `context' to `DeviceRGB' and set
       the components of the current stroke color to `(red, green, blue,
       alpha)'. */
    
    @available(iOS 2.0, *)
    public func setStrokeColor(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)

    
    /* Set the current fill color space in `context' to `DeviceCMYK' and set the
       components of the current fill color to `(cyan, magenta, yellow, black,
       alpha)'. */
    
    @available(iOS 2.0, *)
    public func setFillColor(cyan: CGFloat, magenta: CGFloat, yellow: CGFloat, black: CGFloat, alpha: CGFloat)

    
    /* Set the current stroke color space in `context' to `DeviceCMYK' and set
       the components of the current stroke color to `(cyan, magenta, yellow,
       black, alpha)'. */
    
    @available(iOS 2.0, *)
    public func setStrokeColor(cyan: CGFloat, magenta: CGFloat, yellow: CGFloat, black: CGFloat, alpha: CGFloat)

    
    
    /* Set the rendering intent in the current graphics state of `context' to
       `intent'. */
    
    /** Rendering intent. **/
    @available(iOS 2.0, *)
    public func setRenderingIntent(_ intent: CGColorRenderingIntent)

    
    /** Image functions. **/
    
    /* Draw `image' in the rectangular area specified by `rect' in the context
       `c'. The image is scaled, if necessary, to fit into `rect'. */
    
    /* Draw `image' tiled in the context `c'. The image is scaled to the size
       specified by `rect' in user space, positioned at the origin of `rect' in
       user space, then replicated, stepping the width of `rect' horizontally
       and the height of `rect' vertically, to fill the current clip region.
       Unlike patterns, the image is tiled in user space, so transformations
       applied to the CTM affect the final result. */
    
    /* Return the interpolation quality for image rendering of `context'. The
       interpolation quality is a gstate parameter which controls the level of
       interpolation performed when an image is interpolated (for example, when
       scaling the image). Note that it is merely a hint to the context: not all
       contexts support all interpolation quality levels. */
    
    @available(iOS 2.0, *)
    public var interpolationQuality: CGInterpolationQuality

    
    /* Set the interpolation quality of `context' to `quality'. */
    
    /** Shadow support. **/
    
    /* Set the shadow parameters in `context'. `offset' specifies a translation
       in base-space; `blur' is a non-negative number specifying the amount of
       blur; `color' specifies the color of the shadow, which may contain a
       non-opaque alpha value. If `color' is NULL, it's equivalent to specifying
       a fully transparent color. The shadow is a gstate parameter. After a
       shadow is specified, all objects drawn subsequently will be shadowed. To
       turn off shadowing, set the shadow color to a fully transparent color (or
       pass NULL as the color), or use the standard gsave/grestore mechanism. */
    
    @available(iOS 2.0, *)
    public func setShadow(offset: CGSize, blur: CGFloat, color: CGColor?)

    
    /* Equivalent to calling
         CGContextSetShadowWithColor(context, offset, blur, color)
       where color is black with 1/3 alpha (i.e., RGBA = {0, 0, 0, 1.0/3.0}) in
       the DeviceRGB color space. */
    
    @available(iOS 2.0, *)
    public func setShadow(offset: CGSize, blur: CGFloat)

    
    /** Gradient and shading functions. **/
    
    /* Fill the current clipping region of `context' with a linear gradient from
       `startPoint' to `endPoint'. The location 0 of `gradient' corresponds to
       `startPoint'; the location 1 of `gradient' corresponds to `endPoint';
       colors are linearly interpolated between these two points based on the
       values of the gradient's locations. The option flags control whether the
       gradient is drawn before the start point or after the end point. */
    
    @available(iOS 2.0, *)
    public func drawLinearGradient(_ gradient: CGGradient, start startPoint: CGPoint, end endPoint: CGPoint, options: CGGradientDrawingOptions)

    
    /* Fill the current clipping region of `context' with a radial gradient
       between two circles defined by the center point and radius of each
       circle. The location 0 of `gradient' corresponds to a circle centered at
       `startCenter' with radius `startRadius'; the location 1 of `gradient'
       corresponds to a circle centered at `endCenter' with radius `endRadius';
       colors are linearly interpolated between these two circles based on the
       values of the gradient's locations. The option flags control whether the
       gradient is drawn before the start circle or after the end circle. */
    
    @available(iOS 2.0, *)
    public func drawRadialGradient(_ gradient: CGGradient, startCenter: CGPoint, startRadius: CGFloat, endCenter: CGPoint, endRadius: CGFloat, options: CGGradientDrawingOptions)

    
    /* Fill the current clipping region of `context' with `shading'. */
    
    @available(iOS 2.0, *)
    public func drawShading(_ shading: CGShading)

    
    
    /* Set the current character spacing in `context' to `spacing'. The
       character spacing is added to the displacement between the origin of one
       character and the origin of the next. */
    
    /** Text functions. **/
    @available(iOS 2.0, *)
    public func setCharacterSpacing(_ spacing: CGFloat)

    
    /* Set the user-space point at which text will be drawn in the context `c'
       to `(x, y)'. */
    
    /* Return the user-space point at which text will be drawn in `context'. */
    
    /* Set the text matrix in the context `c' to `t'. */
    
    /* Return the text matrix in the context `c'. Returns CGAffineTransformIdentity
       if `c' is not a valid context. */
    
    @available(iOS 2.0, *)
    public var textMatrix: CGAffineTransform

    
    /* Set the text drawing mode in the current graphics state of the context
       `c' to `mode'. */
    
    @available(iOS 2.0, *)
    public func setTextDrawingMode(_ mode: CGTextDrawingMode)

    
    /* Set the font in the current graphics state of the context `c' to
       `font'. */
    
    @available(iOS 2.0, *)
    public func setFont(_ font: CGFont)

    
    /* Set the font size in the current graphics state of the context `c' to
       `size'. */
    
    @available(iOS 2.0, *)
    public func setFontSize(_ size: CGFloat)

    
    /* Draw `glyphs', an array of `count' CGGlyphs, at the points specified by
       `positions'. Each element of `positions' specifies the position from the
       associated glyph; the positions are specified in user space. */
    
    
    /* Draw `page' in the current user space of the context `c'. */
    
    /** PDF functions. **/
    @available(iOS 2.0, *)
    public func drawPDFPage(_ page: CGPDFPage)

    
    
    /* Begin a new page. */
    
    /** Output page functions. **/
    @available(iOS 2.0, *)
    public func beginPage(mediaBox: UnsafePointer<CGRect>?)

    
    /* End the current page. */
    
    @available(iOS 2.0, *)
    public func endPage()

    
    /** Context functions. **/
    
    /* Equivalent to `CFRetain(c)'. */
    
    /* Equivalent to `CFRelease(c)'. */
    
    /* Flush all drawing to the destination. */
    
    @available(iOS 2.0, *)
    public func flush()

    
    /* Synchronized drawing. */
    
    @available(iOS 2.0, *)
    public func synchronize()

    
    /** Antialiasing functions. **/
    
    /* Turn on antialiasing if `shouldAntialias' is true; turn it off otherwise.
       This parameter is part of the graphics state. */
    
    @available(iOS 2.0, *)
    public func setShouldAntialias(_ shouldAntialias: Bool)

    
    /* Allow antialiasing in `context' if `allowsAntialiasing' is true; don't
       allow it otherwise. This parameter is not part of the graphics state. A
       context will perform antialiasing if both `allowsAntialiasing' and the
       graphics state parameter `shouldAntialias' are true. */
    
    @available(iOS 2.0, *)
    public func setAllowsAntialiasing(_ allowsAntialiasing: Bool)

    
    /** Font display functions. **/
    
    /* Turn on font smoothing if `shouldSmoothFonts' is true; turn it off
       otherwise. This parameter is part of the graphics state. Note that this
       doesn't guarantee that font smoothing will occur: not all destination
       contexts support font smoothing. */
    
    @available(iOS 2.0, *)
    public func setShouldSmoothFonts(_ shouldSmoothFonts: Bool)

    
    /* If `allowsFontSmoothing' is true, then allow font smoothing when
       displaying text in `context'; otherwise, don't allow font smoothing. This
       parameter is not part of the graphics state. Fonts will be smoothed if
       they are antialiased when drawn and if both `allowsFontSmoothing' and the
       graphics state parameter `shouldSmoothFonts' are true. */
    
    @available(iOS 2.0, *)
    public func setAllowsFontSmoothing(_ allowsFontSmoothing: Bool)

    
    /* If `shouldSubpixelPositionFonts' is true, then glyphs may be placed at
       subpixel positions (if allowed) when displaying text in `context';
       otherwise, glyphs will be forced to integer pixel boundaries. This
       parameter is part of the graphics state. */
    
    @available(iOS 2.0, *)
    public func setShouldSubpixelPositionFonts(_ shouldSubpixelPositionFonts: Bool)

    
    /* If `allowsFontSubpixelPositioning' is true, then allow font subpixel
       positioning when displaying text in `context'; otherwise, don't allow
       subpixel positioning. This parameter is not part of the graphics state. A
       context will place glyphs at subpixel positions if fonts will be
       antialiased when drawn and if both `allowsFontSubpixelPositioning' and
       the graphics state parameter `shouldSubpixelPositionFonts' are true. */
    
    @available(iOS 2.0, *)
    public func setAllowsFontSubpixelPositioning(_ allowsFontSubpixelPositioning: Bool)

    
    /* If `shouldSubpixelQuantizeFonts' is true, then quantize the subpixel
       positions of glyphs when displaying text in `context'; otherwise, don't
       quantize the subpixel positions. This parameter is part of the graphics
       state. */
    
    @available(iOS 2.0, *)
    public func setShouldSubpixelQuantizeFonts(_ shouldSubpixelQuantizeFonts: Bool)

    
    /* If `allowsFontSubpixelQuantization' is true, then allow font subpixel
       quantization when displaying text in `context'; otherwise, don't allow
       subpixel quantization. This parameter is not part of the graphics state.
       A context quantizes subpixel positions if glyphs will be drawn at
       subpixel positions and `allowsFontSubpixelQuantization' and the graphics
       state parameter `shouldSubpixelQuantizeFonts' are both true. */
    
    @available(iOS 2.0, *)
    public func setAllowsFontSubpixelQuantization(_ allowsFontSubpixelQuantization: Bool)

    
    
    /* Begin a transparency layer in `context'. All subsequent drawing
       operations until a corresponding `CGContextEndTransparencyLayer' are
       composited into a fully transparent backdrop (which is treated as a
       separate destination buffer from the context). After the transparency
       layer is ended, the result is composited into the context using the
       global alpha and shadow state of the context. This operation respects the
       clipping region of the context. After a call to this function, all of the
       parameters in the graphics state remain unchanged with the exception of
       the following:
         - The global alpha is set to 1.
         - The shadow is turned off.
         - The blend mode is set to `kCGBlendModeNormal'.
       Ending the transparency layer restores these parameters to the values
       they had before `CGContextBeginTransparencyLayer' was called.
       Transparency layers may be nested. */
    
    /** Transparency layer support. **/
    @available(iOS 2.0, *)
    public func beginTransparencyLayer(auxiliaryInfo: CFDictionary?)

    
    /* Begin a transparency layer in `context'. This function is identical to
      `CGContextBeginTransparencyLayer' except that the content of the
      transparency layer will be bounded by `rect' (specified in user space). */
    
    @available(iOS 2.0, *)
    public func beginTransparencyLayer(in rect: CGRect, auxiliaryInfo auxInfo: CFDictionary?)

    
    /* End a tranparency layer. */
    
    @available(iOS 2.0, *)
    public func endTransparencyLayer()

    
    
    /* Return the affine transform mapping the user space (abstract coordinates)
       of `context' to device space (pixels). */
    
    /** User space to device space tranformations. **/
    @available(iOS 2.0, *)
    public var userSpaceToDeviceSpaceTransform: CGAffineTransform { get }

    
    /* Transform `point' from the user space of `context' to device space. */
    
    @available(iOS 2.0, *)
    public func convertToDeviceSpace(_ point: CGPoint) -> CGPoint

    
    /* Transform `point' from device space to the user space of `context'. */
    
    @available(iOS 2.0, *)
    public func convertToUserSpace(_ point: CGPoint) -> CGPoint

    
    /* Transform `size' from the user space of `context' to device space. */
    
    @available(iOS 2.0, *)
    public func convertToDeviceSpace(_ size: CGSize) -> CGSize

    
    /* Transform `size' from device space to the user space of `context'. */
    
    @available(iOS 2.0, *)
    public func convertToUserSpace(_ size: CGSize) -> CGSize

    
    /* Transform `rect' from the user space of `context' to device space. Since
       affine transforms do not preserve rectangles in general, this function
       returns the smallest rectangle which contains the transformed corner
       points of `rect'. */
    
    @available(iOS 2.0, *)
    public func convertToDeviceSpace(_ rect: CGRect) -> CGRect

    
    /* Transform `rect' from device space to the user space of `context'. Since
       affine transforms do not preserve rectangles in general, this function
       returns the smallest rectangle which contains the transformed corner
       points of `rect'. */
    
    @available(iOS 2.0, *)
    public func convertToUserSpace(_ rect: CGRect) -> CGRect
}
